package com.foreknow.web;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.foreknow.entity.Department;
import com.foreknow.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/department")
public class DepartmentController {
    private DepartmentService departmentService;
    @Autowired
    public void setDepartmentService(DepartmentService departmentService) {
        this.departmentService = departmentService;
    }

    @RequestMapping(value = "/findDepartment", method = RequestMethod.GET)
    public List<Department> findUserByPage() throws JsonProcessingException {
        return  departmentService.queryAllDepartment();
    }
}
